<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateGuildHostManageTable extends Migration
{
    protected $connection = 'guild';

    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('guild_host_manage', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('guild_manage_id')->default(0)->comment('公会内部ID');
            $table->integer('host_user_id')->default(0)->comment('主播用户ID（app账号ID）');
            $table->tinyInteger('verf_status')->default(1)->comment('主播当前认证状态');
            $table->double('income_coin', 1)->default(0)->comment('主播在该公会下产生的总金币分成');
            $table->timestamp('unbind_at', 0)->nullable();
            $table->timestamps();
            $table->tinyInteger('status')->default(1)->comment('公会状态');
            $table->index(['guild_manage_id', 'host_user_id'], 'guild_host');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('guild_host_manage');
    }
}
